#include <basic/errcode.h>
#include <basic/sig.h>

void sig_set_handler(int signo, void (*sighandler)(int))
{/*{{{*/
    struct sigaction new_sa;

    if(sighandler)
        new_sa.sa_handler=sighandler;
    else
        new_sa.sa_handler=SIG_IGN;
    sigemptyset(&new_sa.sa_mask);
    new_sa.sa_flags=0;
    sigaction(signo, &new_sa, NULL);
}/*}}}*/

void sig_thrd_block(int signo)
{/*{{{*/
    sigset_t newmask;

    sigemptyset(&newmask);
    sigaddset(&newmask, signo);
    pthread_sigmask(SIG_BLOCK, &newmask, NULL);
}/*}}}*/
